package com.example.springcloud.alibaba.dao;

import com.example.springcloud.alibaba.model.Storage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

@Repository
public interface StorageDao extends Mapper<Storage> {
    @Update("update t_storage set total=total - #{currentUsed} , used=used + #{currentUsed} where product_id=#{productId}")
    int updateUsed(@Param("productId") long productId, @Param("currentUsed") long currentUsed);
}
